package com.racetrack

class AdminFilters {
  def filters = { 
    adminOnly(controller:'*',  
             action:"(create|edit|update|delete|save)") { 
      before = {       
        if(!session?.user?.admin){ 
          flash.message = "Sorry, this action is admin only" 
          redirect(controller:"race", action:"list") 
          return false 
        } 
      } 
    } 
  } 

/*
    def filters = {
        all(controller:'*', action:'*') {
            before = {

            }
            after = { Map model ->

            }
            afterView = { Exception e ->

            }
        }
    }
*/
}
